package com.xian.tszs.meal.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xian.tszs.meal.entity.GsCategory;
import com.xian.tszs.meal.mapper.GsCategoryMapper;
import com.xian.tszs.meal.repository.GsCategoryRepository;
import com.xian.tszs.meal.service.GsCategoryService;
import com.xian.tszs.meal.utils.UUIDUtils;

@Service
public class GscategoryServiceImpl implements GsCategoryService {
	
	@Autowired
	private GsCategoryRepository gsCateRep;
	
	@Autowired
	private GsCategoryMapper gsCateMapper;
	
	@Override
	public List<GsCategory> findGscategoryAll(GsCategory gsCategory) {
		
		return gsCateMapper.findAllByPage(gsCategory);
	}

	@Override
	public void updateCategory(String field, String value, String id) {
		
		gsCateMapper.updateCategory(field,value,id);
	}

	@Override
	public void saveCategory(GsCategory gsCategory) {
		
		
		gsCategory.setId(UUIDUtils.getUUID());
		gsCategory.setCreateTime(new Date());
		
		gsCateRep.save(gsCategory);
	}

	@Override
	public void deleteCategory(String id) {
		gsCateRep.deleteById(id);
	}

	@Override
	public List<GsCategory> findGscateByBusinessId(String id) {
		return gsCateMapper.findAllByBusinessId(id);
	}

	@Override
	public void deleteMany(String[] ids) {
		
		
		gsCateMapper.deleteMany(ids);
		
	}

}
